package common;

import android.app.Application;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;

import java.util.List;

import model.AlarmData;
import model.StoreInfoModel;
import model.Threshold;
import model.User;
import ui.GetFazhiSucessListener;


/**
 * Created by chuanyhu on 2014/8/a.
 */
public class AppContext extends Application {

    private static AppContext instance;
	private StoreInfoModel storeInfoModel;

	public StoreInfoModel getStoreInfoModel() {
		return storeInfoModel;
	}

	public void setStoreInfoModel(StoreInfoModel storeInfoModel) {
		this.storeInfoModel = storeInfoModel;
	}

	public static AppContext getInstance() {
        if (instance == null) {
            instance = new AppContext();
        }
        return instance;
    }

    public static void setInstance(AppContext instance) {
        AppContext.instance = instance;
    }


    @Override
    public void onCreate() {
        super.onCreate();
        instance = this;

    }
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    private List<AlarmData> AlarmDatas;

    private boolean isAdmin = false;

    public boolean isAdmin() {
        return isAdmin;
    }

    public void setAdmin(boolean admin) {
        isAdmin = admin;
    }

    public List<AlarmData> getAlarmDatas() {
        return AlarmDatas;
    }

    public void setAlarmDatas(List<AlarmData> alarmDatas) {
        try {
            if (null != AlarmDatas) {
                AlarmDatas.clear();
            }
            AlarmDatas = alarmDatas;
        } catch (Exception ex) {
            Log.e("APPCONTEXT", ex.toString());
        }

    }

}

